/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = t__get_retcode.c                                   */
/*  NOTE      =                                                    */
/*  DATE      = 2017/03/24 by jikw                                 */
/*******************************************************************/

#include <CUnit/Basic.h>
#include <stdlib.h>

#include <cq_city_payment/cq_city_payment_core.h>
#include "frcomm.h"
#include "frmem.h"
#include "conntrack.h"
#include "frct_comm.h"
#include "frsutl.h"
#include "frreport_comm.h"
#include "frbyte_buffer.h"
#include "../../../src/module/cq_city_payment/config.h"

extern int __get_retcode(unsigned int i_key);

static int __suite_init(void)
{

	return 0;
}

static int __suite_cleanup(void)
{

	return 0;
}

static void case1(void)
{
    int i_ret = 0;

    i_ret = __get_retcode(0);

    CU_ASSERT_EQUAL(i_ret, -1);

    return;
}

static void case2(void)
{
    int i_ret = 0;

    i_ret = __get_retcode(0x30000000);

    CU_ASSERT_EQUAL(i_ret, 0);

    return;
}

static void case3(void)
{
    int i_ret = 0;

    i_ret = __get_retcode(0x30303030);

    CU_ASSERT_EQUAL(i_ret, 1);

    return;
}

int add_suite__get_retcode(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite(MODULE_NAME" __get_retcode()", __suite_init, __suite_cleanup)) == NULL)
        return FR_FAIL;

    if (CU_add_test(pSuite, "case1", case1) == NULL ||
        CU_add_test(pSuite, "case2", case2) == NULL ||
        CU_add_test(pSuite, "case3", case3) == NULL)
        return FR_FAIL;

    return FR_SUCC;
}
